<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-show</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="button" value="切换显示状态" @click="changeIsShow">
        <input type="button" value="累加年龄" @click="addAge">
        <img v-show="isShow" src="test.jpg" alt="">
        <img v-show="age>=18" src="test.jpg" alt="">
    </div>

    <script>
        var app = new Vue({
            // el挂载点
            el:"#app",
            // data数据
            data:{
                isShow:false,
                age:15
            },
            // methods方法
            methods:{
                changeIsShow:function(){
                    this.isShow = !this.isShow;
                },
                addAge:function(){
                    this.age++;
                }

            }

        })
    </script>
    
</body>
</html>